package sugarbind_input

class ArticleController {

    def scaffold = true
	
	def ddlarticles = {}
	
	def findArticles = {
		println("findArticles params : " +params)		
			
		def article_Type 
		def articles
		
		try
		{
			article_Type = Article_Type.get(params.article_Type)
			println("findArticles article_Type : "+article_Type)
		}
		catch(Exception ex)
		{	
			println(ex.getMessage())
		}

		if(article_Type != null)
		{				
			articles = article_Type.articles
//			render(template: 'ddlArticles', model:  [articles : article_Type.articles])
		}
		else
		{
			articles = Article.listArticles()				
		}
		println(articles)
		render(template: 'ddlArticles', model:  [articles : articles])		
	  }
}
